home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / CIncludes / ShutDown.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  2.8 KB  |  109 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        ShutDown.h
  3.  
  4.      Contains:    Shutdown Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1987-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __SHUTDOWN__
  18. #define __SHUTDOWN__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23. #ifndef __MIXEDMODE__
  24. #include <MixedMode.h>
  25. #endif
  26.  
  27.  
  28.  
  29. #if PRAGMA_ONCE
  30. #pragma once
  31. #endif
  32.  
  33. #ifdef __cplusplus
  34. extern "C" {
  35. #endif
  36.  
  37. #if PRAGMA_IMPORT
  38. #pragma import on
  39. #endif
  40.  
  41. #if PRAGMA_STRUCT_ALIGN
  42.     #pragma options align=mac68k
  43. #elif PRAGMA_STRUCT_PACKPUSH
  44.     #pragma pack(push, 2)
  45. #elif PRAGMA_STRUCT_PACK
  46.     #pragma pack(2)
  47. #endif
  48.  
  49.  
  50. enum {
  51.     sdOnPowerOff                = 1,                            /*call procedure before power off.*/
  52.     sdOnRestart                    = 2,                            /*call procedure before restart.*/
  53.     sdOnUnmount                    = 4,                            /*call procedure before unmounting.*/
  54.     sdOnDrivers                    = 8,                            /*call procedure before closing drivers.*/
  55.     sdOnBootVolUnmount            = 16,                            /*call procedure before unmounting boot volume and VM volume but after unmounting all other volumes*/
  56.     sdRestartOrPower            = 3                                /*call before either power off or restart.*/
  57. };
  58.  
  59. typedef CALLBACK_API( void , ShutDwnProcPtr )(short shutDownStage);
  60. /*
  61.     WARNING: ShutDwnProcPtr uses register based parameters under classic 68k
  62.              and cannot be written in a high-level language without 
  63.              the help of mixed mode or assembly glue.
  64. */
  65. typedef REGISTER_UPP_TYPE(ShutDwnProcPtr)                         ShutDwnUPP;
  66. enum { uppShutDwnProcInfo = 0x00001002 };                         /* register no_return_value Func(2_bytes:D0) */
  67. #define NewShutDwnProc(userRoutine)                             (ShutDwnUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppShutDwnProcInfo, GetCurrentArchitecture())
  68. #if TARGET_OS_MAC && TARGET_CPU_68K && !TARGET_RT_MAC_CFM
  69.     #pragma parameter CallShutDwnProc(__A0, __D0)
  70.     void CallShutDwnProc(ShutDwnUPP routine, short shutDownStage) = 0x4E90;
  71. #else
  72.     #define CallShutDwnProc(userRoutine, shutDownStage)         CALL_ONE_PARAMETER_UPP((userRoutine), uppShutDwnProcInfo, (shutDownStage))
  73. #endif
  74. EXTERN_API( void )
  75. ShutDwnPower                    (void)                                                        THREEWORDINLINE(0x3F3C, 0x0001, 0xA895);
  76.  
  77. EXTERN_API( void )
  78. ShutDwnStart                    (void)                                                        THREEWORDINLINE(0x3F3C, 0x0002, 0xA895);
  79.  
  80. EXTERN_API( void )
  81. ShutDwnInstall                    (ShutDwnUPP             shutDownProc,
  82.                                  short                     flags)                                THREEWORDINLINE(0x3F3C, 0x0003, 0xA895);
  83.  
  84. EXTERN_API( void )
  85. ShutDwnRemove                    (ShutDwnUPP             shutDownProc)                        THREEWORDINLINE(0x3F3C, 0x0004, 0xA895);
  86.  
  87.  
  88.  
  89. #if PRAGMA_STRUCT_ALIGN
  90.     #pragma options align=reset
  91. #elif PRAGMA_STRUCT_PACKPUSH
  92.     #pragma pack(pop)
  93. #elif PRAGMA_STRUCT_PACK
  94.     #pragma pack()
  95. #endif
  96.  
  97. #ifdef PRAGMA_IMPORT_OFF
  98. #pragma import off
  99. #elif PRAGMA_IMPORT
  100. #pragma import reset
  101. #endif
  102.  
  103. #ifdef __cplusplus
  104. }
  105. #endif
  106.  
  107. #endif /* __SHUTDOWN__ */
  108.  
  109.